package SNHttpServer

import (
	"net/http"
	"frame/utils/PropertiesUtils"
	"frame/controller/ControllerModule"
	"frame/logger/HLogger"
	"runtime"
)
var logger = HLogger.GetHLogger("SNHttpServer")

func Run(){

	runtime.GOMAXPROCS(runtime.NumCPU())
	var serverip,_ = PropertiesUtils.GetConfig("server","serverip","0.0.0.0")
	var serverport,_ = PropertiesUtils.GetConfig("server","serverport","8080")
	var address = serverip+":"+serverport

	http.HandleFunc("/",func(respwriter http.ResponseWriter, req *http.Request){
		ControllerModule.Handler(req.URL.String(),req,respwriter)
	})

	logger.Info("SNHttpServer启动成功["+address+"]")
	http.ListenAndServe(address, nil)

}
